package com.vickw.springcloud.controller;

import com.vickw.springcloud.entity.CommonResult;
import com.vickw.springcloud.entity.Payment;
import com.vickw.springcloud.service.PaymentFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @version 1.0
 * @Description：
 * @Author VickW
 * @Date 2022/3/17 23:09
 */
@RestController
public class CustomerFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/feign/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return paymentFeignService.getPaymentById(id);
    }

    @GetMapping(value = "/consumer/payment/feign/timeout")
    public String paymentFeignTimeout(){
        // openFeign - ribbon 客户端一般默认等待一秒钟
        return paymentFeignService.paymentFeignTimeout();
    }

}
